package com.sky.business.sys.vo;

import com.sky.business.sys.domain.Node;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;

@EqualsAndHashCode(callSuper = true)
@Data
public class NodeVo extends Node {

    @Serial
    private static final long serialVersionUID = -3550625190827872550L;

    @Schema(description = "组名称")
    private String groupName;

    public NodeVo(Node node, String groupName) {
        this.setId(node.getId());
        this.setDescription(node.getDescription());
        this.setArch(node.getArch());
        this.setIpAddr(node.getIpAddr());
        this.setContainerPort(node.getContainerPort());
        this.setReady(node.getReady());
        this.setTotalMemory(node.getTotalMemory());
        this.setFreeMemory(node.getFreeMemory());
        this.setUsedMemory(node.getUsedMemory());
        this.setCpuLogicalCore(node.getCpuLogicalCore());
        this.setCpuPhysicalCore(node.getCpuPhysicalCore());
        this.setCpuIdlePercent(node.getCpuIdlePercent());
        this.setDiskFree(node.getDiskFree());
        this.setGpuCount(node.getGpuCount());
        this.setGpuIdleMemory(node.getGpuIdleMemory());
        this.setGroupId(node.getGroupId());
        this.setLastHeartBeatTime(node.getLastHeartBeatTime());
        this.setCreateTime(node.getCreateTime());
        this.setUpdateTime(node.getUpdateTime());
        this.groupName = groupName;
    }
}
